package flexo.gui.flat;

import flexo.math.Coords;
import flexo.scene.Node;

public class Button extends flexo.gui.Button
{
	Panel panel;
	String materialStd;
	String materialOver;
	
	public Button(String name, Coords size, String material, String materialOver)
	{
		super(name, size);
		this.materialOver = materialOver;
		this.materialStd = material;
		panel = new Panel(name,size,materialStd);
	}
	
	@Override
	public boolean attachTo(Node n)
	{
		boolean result = super.attachTo(n);
		if (result)
		{
			panel.attachTo(n);
		}
		return result;
	}
	
	public void deattachFrom(Node n)
	{
		panel.deattachFrom(n);
		super.deattachFrom(n);		
	}

	@Override
	public void over()
	{
		panel.setMaterial(materialOver);
	}

	@Override
	public void standard()
	{
		panel.setMaterial(materialStd);
	}
}
